package cn.jltx.ndkcallback;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import cn.jltx.ndkcallback.javajni.DataProvider;
import cn.jltx.ndkcallback.javajni.DataProviderCall;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    private DataProvider dataProvider;
    private Button btn1;
    private Button btn2;
    private Button btn3;
    private Button btn4;
    private Button btn5;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        dataProvider = new DataProvider();
        btn1 = (Button)findViewById(R.id.btn1);
        btn2 = (Button)findViewById(R.id.btn2);
        btn3 = (Button)findViewById(R.id.btn3);
        btn4 = (Button)findViewById(R.id.btn4);
        btn5 = (Button)findViewById(R.id.btn5);
        btn1.setOnClickListener(this);
        btn2.setOnClickListener(this);
        btn3.setOnClickListener(this);
        btn4.setOnClickListener(this);
        btn5.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn1:
                dataProvider.callmethod1();
                break;
            case R.id.btn2:
                dataProvider.callmethod2();
                break;
            case R.id.btn3:
                dataProvider.callmethod3();
                break;
            case R.id.btn4:
                dataProvider.callmethod4();
                break;
            case R.id.btn5:
                DataProviderCall.callDataProviderMethod1();
                break;
            default:
                break;
        }
    }
}
